package day08.thread;

import day08.thread.Alogin;
import day08.thread.Blogin;
import day08.thread.ThreadByExtendTest;
import day08.thread.ThreadByRunnable;

/**
 * @Auther: sky
 * @Date: 2019/3/2 21:48
 * @Description:
 */
public class Run {

    public static void main(String[] args) {
        ThreadByExtendTest threadByExtendTest=new ThreadByExtendTest();
        ThreadByExtendTest threadByExtendTest1=new ThreadByExtendTest();
        ThreadByExtendTest threadByExtendTest2=new ThreadByExtendTest();
        ThreadByExtendTest threadByExtendTest3=new ThreadByExtendTest();
        threadByExtendTest1.start();
        threadByExtendTest.start();
        threadByExtendTest3.start();
        threadByExtendTest2.start();//多次调用start会报错IllegalThreadStateException
        System.out.println("end");//与代码执行顺序无关

        getRunnable();
        getRunnableByThreadByExtendTest();

        mockServlet();
    }

    public static void getRunnable(){
        Runnable runnable = new ThreadByRunnable();
        Thread thread = new Thread(runnable);
        thread.start();
        System.out.println("获取结果");
    }

    public static void getRunnableByThreadByExtendTest(){
        ThreadByExtendTest threadByExtendTest = new ThreadByExtendTest();
        Thread thread = new Thread(threadByExtendTest);
        thread.start();
        System.out.println("获取结果");
    }

    public static void mockServlet(){
        Alogin alogin = new Alogin();
        alogin.start();


        Blogin blogin=new Blogin();
        blogin.start();
    }


}
